package o;

import androidx.annotation.Nullable;

public class dz<E> implements Cloneable {
    private static final Object ˋ = new Object();
    private boolean ˊ;
    private Object[] ˎ;
    private int[] ˏ;
    private int ॱ;

    public /* synthetic */ Object clone() throws CloneNotSupportedException {
        return ॱ();
    }

    public dz() {
        this(10);
    }

    public dz(int i) {
        this.ˊ = false;
        if (i == 0) {
            this.ˏ = dt.ॱ;
            this.ˎ = dt.ˋ;
            return;
        }
        int ॱ = dt.ॱ(i);
        this.ˏ = new int[ॱ];
        this.ˎ = new Object[ॱ];
    }

    public dz<E> ॱ() {
        try {
            dz<E> dzVar = (dz) super.clone();
            dzVar.ˏ = (int[]) this.ˏ.clone();
            dzVar.ˎ = (Object[]) this.ˎ.clone();
            return dzVar;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError(e);
        }
    }

    @Nullable
    public E ˊ(int i) {
        return ॱ(i, null);
    }

    public E ॱ(int i, E e) {
        int ˋ = dt.ˋ(this.ˏ, this.ॱ, i);
        return (ˋ < 0 || this.ˎ[ˋ] == ˋ) ? e : this.ˎ[ˋ];
    }

    public void ॱ(int i) {
        int ˋ = dt.ˋ(this.ˏ, this.ॱ, i);
        if (ˋ >= 0 && this.ˎ[ˋ] != ˋ) {
            this.ˎ[ˋ] = ˋ;
            this.ˊ = true;
        }
    }

    private void ˊ() {
        int i = this.ॱ;
        int[] iArr = this.ˏ;
        Object[] objArr = this.ˎ;
        int i2 = 0;
        for (int i3 = 0; i3 < i; i3++) {
            Object obj = objArr[i3];
            if (obj != ˋ) {
                if (i3 != i2) {
                    iArr[i2] = iArr[i3];
                    objArr[i2] = obj;
                    objArr[i3] = null;
                }
                i2++;
            }
        }
        this.ˊ = false;
        this.ॱ = i2;
    }

    public void ˋ(int i, E e) {
        int ˋ = dt.ˋ(this.ˏ, this.ॱ, i);
        if (ˋ >= 0) {
            this.ˎ[ˋ] = e;
            return;
        }
        ˋ ^= -1;
        if (ˋ >= this.ॱ || this.ˎ[ˋ] != ˋ) {
            if (this.ˊ && this.ॱ >= this.ˏ.length) {
                ˊ();
                ˋ = dt.ˋ(this.ˏ, this.ॱ, i) ^ -1;
            }
            if (this.ॱ >= this.ˏ.length) {
                int ॱ = dt.ॱ(this.ॱ + 1);
                Object obj = new int[ॱ];
                Object obj2 = new Object[ॱ];
                System.arraycopy(this.ˏ, 0, obj, 0, this.ˏ.length);
                System.arraycopy(this.ˎ, 0, obj2, 0, this.ˎ.length);
                this.ˏ = obj;
                this.ˎ = obj2;
            }
            if (this.ॱ - ˋ != 0) {
                System.arraycopy(this.ˏ, ˋ, this.ˏ, ˋ + 1, this.ॱ - ˋ);
                System.arraycopy(this.ˎ, ˋ, this.ˎ, ˋ + 1, this.ॱ - ˋ);
            }
            this.ˏ[ˋ] = i;
            this.ˎ[ˋ] = e;
            this.ॱ++;
            return;
        }
        this.ˏ[ˋ] = i;
        this.ˎ[ˋ] = e;
    }

    public int ˋ() {
        if (this.ˊ) {
            ˊ();
        }
        return this.ॱ;
    }

    public int ˋ(int i) {
        if (this.ˊ) {
            ˊ();
        }
        return this.ˏ[i];
    }

    public E ˎ(int i) {
        if (this.ˊ) {
            ˊ();
        }
        return this.ˎ[i];
    }

    public int ˏ(int i) {
        if (this.ˊ) {
            ˊ();
        }
        return dt.ˋ(this.ˏ, this.ॱ, i);
    }

    public int ˏ(E e) {
        if (this.ˊ) {
            ˊ();
        }
        for (int i = 0; i < this.ॱ; i++) {
            if (this.ˎ[i] == e) {
                return i;
            }
        }
        return -1;
    }

    public void ˏ() {
        int i = this.ॱ;
        Object[] objArr = this.ˎ;
        for (int i2 = 0; i2 < i; i2++) {
            objArr[i2] = null;
        }
        this.ॱ = 0;
        this.ˊ = false;
    }

    public void ˏ(int i, E e) {
        if (this.ॱ == 0 || i > this.ˏ[this.ॱ - 1]) {
            if (this.ˊ && this.ॱ >= this.ˏ.length) {
                ˊ();
            }
            int i2 = this.ॱ;
            if (i2 >= this.ˏ.length) {
                int ॱ = dt.ॱ(i2 + 1);
                Object obj = new int[ॱ];
                Object obj2 = new Object[ॱ];
                System.arraycopy(this.ˏ, 0, obj, 0, this.ˏ.length);
                System.arraycopy(this.ˎ, 0, obj2, 0, this.ˎ.length);
                this.ˏ = obj;
                this.ˎ = obj2;
            }
            this.ˏ[i2] = i;
            this.ˎ[i2] = e;
            this.ॱ = i2 + 1;
            return;
        }
        ˋ(i, e);
    }

    public String toString() {
        if (ˋ() <= 0) {
            return "{}";
        }
        StringBuilder stringBuilder = new StringBuilder(this.ॱ * 28);
        stringBuilder.append('{');
        for (int i = 0; i < this.ॱ; i++) {
            if (i > 0) {
                stringBuilder.append(", ");
            }
            stringBuilder.append(ˋ(i));
            stringBuilder.append('=');
            dz ˎ = ˎ(i);
            if (ˎ != this) {
                stringBuilder.append(ˎ);
            } else {
                stringBuilder.append("(this Map)");
            }
        }
        stringBuilder.append('}');
        return stringBuilder.toString();
    }
}
